const fs = require('fs')
const path = require('path')
const Router = require('koa-router')

const router = new Router({ prefix: '/api' })

fs.readdirSync(__dirname).forEach(file => {
    if (file !== 'index.js') {
        const route = require(path.join(__dirname + '/' + file))
        router.use(route.routes())
    }
})

module.exports = router